class Solution:
    def maxPartitionsAfterOperations(self, s: str, k: int) -> int:
        n = len(s)
        record = set()
        used = False
        ans = 1
        for i in range(n):
            if s[i] not in record and len(record) >= k:
                # 需要分割
                if not used and len(record) <= 25:
                    record.add('.')  # 使用不存在字符占位
                    used = True
                else:
                    ans += 1
                    used = False
                    record = set()
            record.add(s[i])
        return ans

if __name__ == '__main__':
    s = Solution()
    r = s.maxPartitionsAfterOperations(s = "accca", k = 2)
    print(r)